import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TenementbasicInfoVO, TenementbasicInfoForm, TenementbasicInfoQuery } from '@/api/zichanguanli/tenementbasicInfo/types';

/**
 * 物业统计信息栏
 * @param query
 * @returns {*}
 */

export const statistics = (query?: any): AxiosPromise<TenementbasicInfoVO[]> => {
  return request({
    url: '/zichanguanli/tenementbasicInfo/statistics',
    method: 'get',
    params: query
  });
};

/**
 * 物业各个人员数量饼图
 * @param query
 * @returns {*}
 */

export const personCountPie = (query?: any): AxiosPromise<TenementbasicInfoVO[]> => {
  return request({
    url: '/zichanguanli/tenementbasicInfo/personCountPie',
    method: 'get',
    params: query
  });
};

/**
 * 项目人数排行
 * @param query
 * @returns {*}
 */

export const personRank = (query?: any): AxiosPromise<TenementbasicInfoVO[]> => {
  return request({
    url: '/zichanguanli/tenementbasicInfo/personRank',
    method: 'get',
    params: query
  });
};

/**
 * 项目配比排行
 * @param query
 * @returns {*}
 */

export const propertyRank = (query?: any): AxiosPromise<TenementbasicInfoVO[]> => {
  return request({
    url: '/zichanguanli/tenementbasicInfo/propertyRank',
    method: 'get',
    params: query
  });
};

/**
 * 查询物业基础信息列表
 * @param query
 * @returns {*}
 */

export const listTenementbasicInfo = (query?: TenementbasicInfoQuery): AxiosPromise<TenementbasicInfoVO[]> => {
  return request({
    url: '/zichanguanli/tenementbasicInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物业基础信息详细
 * @param id
 */
export const getTenementbasicInfo = (id: string | number): AxiosPromise<TenementbasicInfoVO> => {
  return request({
    url: '/zichanguanli/tenementbasicInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增物业基础信息
 * @param data
 */
export const addTenementbasicInfo = (data: TenementbasicInfoForm): AxiosPromise<string | number> => {
  return request({
    url: '/zichanguanli/tenementbasicInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改物业基础信息
 * @param data
 */
export const updateTenementbasicInfo = (data: TenementbasicInfoForm) => {
  return request({
    url: '/zichanguanli/tenementbasicInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除物业基础信息
 * @param id
 */
export const delTenementbasicInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/tenementbasicInfo?ids=' + id,
    method: 'delete'
  });
};
